package com.pro.common.api.pay.model.db;

import com.pro.common.api.CommonConst;
import com.pro.common.api.model.BaseUserModel;
import com.pro.common.api.model.auth.IUserDataClass;
import com.pro.common.api.model.request.pay.IPaymentParams;
import com.pro.common.api.model.request.pay.IPaymentParamsDTO;
import com.pro.common.api.pay.enums.EnumPaymentStatus;
import com.pro.framework.javatodb.annotation.JTDField;
import com.pro.framework.javatodb.annotation.JTDTable;
import com.pro.framework.javatodb.constant.JTDConst;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 支付订单表
 */
@Data
@Schema(description = "支付订单")
@JTDTable(entityId = 11002, module = CommonConst.Modules.pay,
        sequences = {"UNIQUE KEY orderNo (`order_no`)"})
public class PaymentOrder extends BaseUserModel implements IUserDataClass, IPaymentParamsDTO {

    @Schema(description = "支付订单号")
    private String no;

    @Schema(description = "业务订单号")
    private String orderNo;

    // 输入
    @Schema(description = "业务类型", example = "EnumPaymentBizType_枚举")
    private String bizType;

    @Schema(description = "对应业务单号")
    private Long bizId;

    @Schema(description = "业务描述")
    private String bizDesc;

    @Schema(description = "下单金额")
    private BigDecimal orderAmount;

    @Schema(description = "实际付款金额")
    private BigDecimal payAmount;

    @Schema(description = "支付渠道Id", example = "包含货币和支付方式相关信息")
    @JTDField(entityName = "pay.payChannel", entityClassKey = "id")
    private Long payChannelId;

    @Schema(description = "支付商户编号")
    @JTDField(entityName = "pay.payMerchant")
    private String merchantCode;
    @Schema(description = "支付商户ID")
    @JTDField(entityName = "pay.payMerchant")
    private Long payMerchantId;

    @Schema(description = "货币单位")
    private String currency;

    @Schema(description = "支付订单过期时间")
    private LocalDateTime expireTime;

    @Schema(description = "支付状态")
    private EnumPaymentStatus status;

    @Schema(description = "三方回调时间")
    private LocalDateTime callbackTime;

    @Schema(description = "三方回调内容")
    @JTDField(type = JTDConst.EnumFieldType.text)
    private String callbackContent;

    @Schema(description = "三方回调Id")
    private String outId;

//    @Schema(description = "三方交易号")
//    private String thirdPartyTradeNo;

    @Schema(description = "备注")
    private String remark;
    @Schema(description = "订单标题")
    private String subject;

}
